package com.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/****
 * 在xml中配置load-on-startup 会在程序启动的时候执行init方法
 *
 */
public class ServletDemo5 extends HttpServlet {
	
   @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	    //解决中文乱码问题
	    resp.setCharacterEncoding("utf-8");// 内容编码，防止出现中文乱码
		resp.setContentType("text/html;charset=utf-8");		//向浏览器输出内容
		resp.getWriter().write("ServletDemo5.......................");
}
   @Override
	public void init() throws ServletException {
		System.out.println("ServletDemo5   init");
	}
}
